The SimpleMenu Component > FSimpleMenu.setDataProvider() |
FSimpleMenu.setDataProvider()
Availability
Flash Player 6.
Usage
sm_instance.setDataProvider(dataProvider)
Parameters
dataProvider - An object that specifies a data provider class,
which can be a recordset returned from a Flash Remoting function call, an array,
or an instance of the DataProvider class. For more information about Flash Remoting,
see the Macromedia
Flash Remoting MX Application Development Center.
Returns
Nothing.
Description
Specifies the data provider from which to create items on the SimpleMenu.
Whether the data provider is a Flash Remoting recordset, an array, or an instance
of the DataProvider class, the data in Macromedia Flash is in the following
format, where myDP is the dataProvider parameter for the FSimpleMenu.setDataProvider
method:
myDP[0] = {label:"Company Profile", itemType:"fsm_button"}
myDP[1] = {label:"Portfolio", itemType:"fsm_button"}
myDP[2] = {label:"", itemType:"fsm_bar"}
myDP[3] = {label:"Search", itemType:"fsm_button"}
Examples
The following example creates an array containing strings for the label of
each button; fsm_bar is used to add the separator bar:
dataArray = new Array();
dataArray.push("Company Profile", "Contact", "fsm_bar",
"Programs", "Games", "Downloads");
sm.setDataProvider(dataArray);
This example creates an array containing objects defining the navigational items:
dataArray = new Array();
dataArray.push({label:"Button 1",itemType:"fsm_button"});
dataArray.push({label:"Button 2",itemType:"fsm_button"});
dataArray.push({label:"",itemType:"fsm_bar"});
See also
FSimpleMenu.addItem
FSimpleMenu.addItemAt